package com.devunion.bogdan.view.editors;

import java.awt.*;

/**
 * User: user
 * Date: 10.02.2005
 * Time: 23:32:37
 */
public class CoordinateHelper {
    // TODO: can be optimized
    public static Point getLeftTopPoint(Point p1, Point p2) {
        return new Point(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y));
    }

    // TODO: can be optimized
    public static Point getRightBottomPoint(Point p1, Point p2) {
        return new Point(Math.max(p1.x, p2.x), Math.max(p1.y, p2.y));
    }

    public static int getWidth(Point p1, Point p2) {
        return Math.abs(p1.x - p2.x);
    }

    public static int getHeight(Point p1, Point p2) {
        return Math.abs(p1.y - p2.y);
    }
}
